import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
export 'package:fluro/fluro.dart';
import '../page/SplashPage.dart';
export '../page/SplashPage.dart';
import '../page/GuidePage.dart';
export '../page/GuidePage.dart';
import '../page/LoginPage.dart';
export '../page/LoginPage.dart';
import '../page/MainPage.dart';
export '../page/MainPage.dart';

import '../test/Test.dart';

//全局路由管理
class Application {
  static Router router;
}

//所有路由
class Routes {
  static const String SPLASH_ROUTE_NAME = '/'; //闪屏页路由
  static const String GUIDE_ROUTE_NAME = '/guide'; //引导页路由
  static const String LOGIN_ROUTE_NAME = '/login'; //登录路由
  static const String MAIN_ROUTE_NAME = '/main'; //首页路由

  static const String TEST_ROUTE_NAME = '/test'; //测试路由

  //配置路由
  static void configureRoutes(Router router) {
    router.notFoundHandler = new Handler(
        handlerFunc: (BuildContext context, Map<String, List<String>> params) {
      print("ROUTE WAS NOT FOUND !!!");
    });
    router.define(
      SPLASH_ROUTE_NAME,
      handler: splashHandler,
    );
    router.define(
      GUIDE_ROUTE_NAME,
      handler: guideHandler,
      transitionType: TransitionType.inFromRight,
    );
    router.define(
      LOGIN_ROUTE_NAME,
      handler: loginHandler,
      transitionType: TransitionType.inFromBottom,
    );
    router.define(
      MAIN_ROUTE_NAME,
      handler: mainHandler,
      transitionType: TransitionType.fadeIn,
    );

    router.define(
      TEST_ROUTE_NAME,
      handler: testHandler,
      transitionType: TransitionType.inFromRight,
    );
//    router.define(demoSimpleFixedTrans,
//        handler: demoRouteHandler, transitionType: TransitionType.inFromLeft);
//    router.define(demoFunc, handler: demoFunctionHandler);
//    router.define(deepLink, handler: deepLinkHandler);
  }

  static var splashHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return new SplashPage();
  });
  static var guideHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return new GuidePage();
  });
  static var loginHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return new LoginPage();
  });
  static var mainHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return new MainPage();
  });

  static var testHandler = new Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
    return new TestListPage();
  });
}
